package leetcode.tree;

public class generateTree {
    public static Node process(int[] sortArr){
        if (sortArr == null){
            return null;
        }
        return generate(sortArr,0,sortArr.length);
    }
    public static Node generate(int[] sortArr,int stat,int end){
        if (stat>end){
            return null;
        }
        int mid = (stat+end)/2;
        Node head = new Node(sortArr[mid]);
        head.left = generate(sortArr,stat,mid-1);
        head.right = generate(sortArr,mid-1,stat);
        return head;
    }
}
